# -*- cmake -*-

# Here we have a bunch of user defined commands that are being loaded at the
# very start of the makefile generation process. You can use this setup file to
# for example change compiler flags.

# Enable the RW_ASSERT macro
OPTION(RW_ENABLE_ASSERT "Enables RW_ASSERT macro: on|off" ON)

# Enable tests and sandbox
SET(RW_BUILD_TESTS ON)
OPTION(RW_ENABLE_PERFORMANCE_TESTS "Set when you want to build the performance tests" ON)
#SET(RW_BUILD_SANDBOX OFF)
SET(RW_BUILD_EXAMPLES OFF)

# RobWork has prebuilt libraries for BLAS and LAPACK
# which can be used on win32. Adding the library directory to the path
# will make RobWork detect these libraries. Add your own if you want
IF(DEFINED MINGW)
  LIST(APPEND CMAKE_LIBRARY_PATH "${RW_ROOT}/ext/libs_mingw/")
ELSEIF(DEFINED MSVC)
  LIST(APPEND CMAKE_LIBRARY_PATH "${RW_ROOT}/ext/libs_vs/")
ENDIF()

# Specify the root dir of your Boost installation if it is not autodetected from the environment
# If the Boost headers or libraries are not found, set the include and lib directories
IF(DEFINED ENV{BOOST_ROOT})
  FILE(TO_CMAKE_PATH $ENV{BOOST_ROOT} BOOST_ROOT)
  #SET(BOOST_INCLUDEDIR "${BOOST_ROOT}/include")
  #SET(BOOST_LIBRARYDIR "${BOOST_ROOT}/lib")
ELSE()
  SET(BOOST_ROOT "")
  #SET(BOOST_INCLUDEDIR "${BOOST_ROOT}/include")
  #SET(BOOST_LIBRARYDIR "${BOOST_ROOT}/lib")
ENDIF()

# If you want to use the new Xerces based XML loader then set to ON. But make sure that
# CMake is able to find the Xerces include and lib dir
IF(DEFINED ENV{XERCES_ROOT})
  FILE(TO_CMAKE_PATH $ENV{XERCES_ROOT} XERCES_ROOT) # to make sure that we use / instead of \ in path
  SET(XERCESC_INCLUDE_DIR "${XERCES_ROOT}/include")
  SET(XERCESC_LIB_DIR "${XERCES_ROOT}/lib")
ENDIF()

# Specify which optional packages you want. These external pacakges are included 
# with RobWork and will be used if other packages are not specified
#SET(RW_DISABLE_LUA OFF)
#SET(RW_DISABLE_YAOBI ON)
#SET(RW_DISABLE_PQP ON)
# set the swig executable to enable swig/lua/python
#SET(SWIG_EXECUTABLE )
SET(RW_PYTHON_BINDINGS_ENABLED ON)


####################### Force specific flags instead of the default RobWork cxx flags

# These flags can be used for coverage testing
IF(ENABLE_COVERAGE)
 SET(RW_CXX_FLAGS "-g -O0 -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fPIC -fprofile-arcs -ftest-coverage")
 SET(CMAKE_C_FLAGS "-g -O0 -Wall -W -fprofile-arcs -ftest-coverage")
 SET(CMAKE_EXE_LINKER_FLAGS "-fprofile-arcs -ftest-coverage")
ENDIF()

# Extra flags which will be appended to RW_CXX_FLAGS
#SET(RW_CXX_FLAGS_EXTRA "-fmessage-length=0") #enable this for eclipse users.

# If you wan't to force some specific libraries then set some of these varaibles
#SET(LUA_INCLUDE_DIR "${RW_ROOT}/ext/lua/src/")
#SET(LUA_LIBRARY_DIR "${RW_ROOT}/libs/release/")
#SET(TOLUA_CMD "${RW_ROOT}/bin/release/tolua")
#SET(TOLUA_INCLUDE_DIR "${RW_ROOT}/ext/tolua/include/")
#SET(TOLUA_LIBRARY_DIR "${RW_ROOT}/libs/release/")

# Specify if you want to enable the use of yaobi for collision detection
#SET(YAOBI_INCLUDE_DIR "${RW_ROOT}/ext/yaobi")
#SET(YAOBI_LIBRARY_DIR "${RW_ROOT}/libs/Release/") # If you use the yaobi from ext then it will be placed in the default 

# Specify if you want to enable the use of pqp for collision detection
#SET(PQP_INCLUDE_DIR "${RW_ROOT}/ext/PQP")
#SET(PQP_LIBRARY_DIR "${RW_ROOT}/ext/PQP")

